var page_controller;
var UA = navigator.userAgent.toLowerCase();//UserAgent
document.addEventListener('touchmove',function(e){
    e.preventDefault();//移除浏览器默认操作
},false);
window.onload = function(){
    //page iscroll init
    pageiScroll = new IScroll('.page_controller',{
        mouseWheel:true,
        scrollbars:true,
        bounce:false,
        click:iScrollClick()
    });
    FastClick.attach(document.body);//加载FastClick插件
    bindClickEvent();//绑定共用部分点击事件
    page_onload();//加载页面onload事件
    //$('.loading_box').fadeOut(200);
}
function iScrollClick(){
    //iScroll click 兼容性问题
    if(/iPhone|iPad|iPod|Macintoch/i.test(UA)) return false;
    if(/Chrome/i.test(UA)) return true;//(/Android/i.test(UA))
    if(/Silk/i.test(UA)) return false;
    if(/Android/i.test(UA)){
        var s = UA.match(/Android [\d+.]{1,5}/)[0].replace('Android','');
        return parseFloat(s[0]+s[2]+s[4])<=442&&parseFloat(s[0]+s[2]+s[4])>430 ? true:false;
    }
}
function showAlertYesNo(msg,yesfunction){
    $('.alert_yn_content>p').html(msg);
    $('.alert_yn_box').fadeIn(200);
    $('.alert_yn_ok').unbind('click');
    $('.alert_yn_ok').on('click',function(){
        yesfunction();
    });
}
function showAlertOk(msg,okfunction){
    $('.alert_success_content>p').html(msg);
    $('.alert_success_box').fadeIn(200);
    $('.alert_success_ok').unbind('click');
    $('.alert_success_ok').on('click',function(){
        okfunction();
    });
}
function bindClickEvent(){
    //
    $('.header_op').on('click',function(){
        var link = $(this).attr('name');
        if(link){
            window.location.href = "/Wap/Index/"+link+".html";
        }
    });
    $('.alert_yn_cancel').on('click',function(){
        $('.alert_yn_box').fadeOut(200);
    });
}